#include "tmp112a.h"


float_t ReadTemprature_TMP112A(void)
{
	uint8_t IIC_RXbuf[2];
	uint16_t temp;
	float_t temprature;
	HAL_I2C_Master_Receive(&hi2c1, 0x91, IIC_RXbuf, 2, 1000);
	temp = IIC_RXbuf[0] << 8 | IIC_RXbuf[1];
	temp = temp >> 4;
	if(temp > 0x800)
	{
		temp = ~temp + 1;
		temprature = (float_t)temp * (-0.0625);
	}
	else
	{
		temprature = (float_t)temp * 0.0625;
	}

		return temprature;
}
